<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>

<script>

	//工厂模式
	function  createPerson(name,age,job) {
		var o = new Object();
		o.name = name;
		o.age = age;
		o.job = job;
		o.sayName = function(){
			alert(this.name);
		};
		return o;
	}

	var person1 = createPerson('Hongwei',34,'Software Engineer');
	var person2 = createPerson('Haofei',28,'Software Engineer');


</script>
</html>